package com.flyinzhen.customer.controller;

import com.flyinzhen.core.annotation.IgnoreToken;
import com.flyinzhen.core.dto.ResponseDto;
import com.flyinzhen.customer.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;

/**
 * 消息控制器
 *
 * @author yinzhen
 * @date 2019-05-01
 */
@Api
@CrossOrigin("*")
@RestController
@RequestMapping(value = "/message", produces = "application/json;charset=UTF-8")
public class MessageController {

    @Resource
    MessageService messageService;

    @IgnoreToken
    @GetMapping("/captcha")
    @ApiOperation(value = "获取验证码", notes = "返回手机验证码")
    public ResponseDto getCaptcha(@RequestParam @NotBlank String phone, @RequestParam(required = false) String deviceId) {
        return messageService.getCaptcha(phone, deviceId);
    }
}